Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

225
Vistas
"Script error" reported in window.onerror without cross-site scripting

Almost every JS error I get using window.onerror is the unhelpful "Script error" message.

I have read everything I can find on this but it is always said it is caused by cross-site scripting, but there's none in my code.

Why do these unhelpful error messages appear and how can I replace them with the full messages that appear in the console?

As a test example, I created a minimal HTML/JS code pair. This is the HTML page, testpage.html:

<html>
<head></head>
  <body>
    <script src="/js/testpage.min.js"></script>
  </body>
</html>

and JS script:

window.onerror = function(msg, url, lineNo, columnNo, error) {
  // code goes here to generate log entry on the server
  return true;
}
// generate illustrative sample error
var jsonData = "";
var data = JSON.parse(jsonData);

Running this, msg = "Script error" and other parameters are either null or zero. The Google DevTools console displays the full error:

Uncaught SyntaxError: Unexpected end of JSON input
  at JSON.parse (<anonymous>)
  at testpage.min.js:7

Any help towards being able to log the full error messages will be most welcome. I'm at a complete loss.

EDIT: Recast to make problem clearer.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda